<template>
  <div class="container" style="height: 100%" @click="allIfreamHide">
    <!-- 面包屑导航 -->
    <div class="breadcrumb">
      <el-breadcrumb separator="">
        <el-breadcrumb-item>
          <div class="div1">数据查询</div>
        </el-breadcrumb-item>
        <el-breadcrumb-item>
          <div class="div2">订单统计数据</div>
        </el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="orderStyle_one">
      此页面做了内部系统的订单统计，内部系统详情见平台分类。可以做备货、已备货、发货、验收的操作。操作数据同步在我的订单里面。
    </div>
    <el-collapse-transition>
      <div class="inquiry" v-show="!show3">
        <div class="header">
          <span>查询订单</span>
          <p @click="show3 = true">收起</p>
        </div>

        <el-form
          :inline="true"
          ref="form"
          :model="queryForm"
          label-width=""
          size="mini"
        >
          <div class="orderStyle">
            <el-form size="mini">
              <el-form-item label="订单状态">
                <el-select
                  v-model="queryForm.orderStatus"
                  placeholder="选择订单状态"
                  filterable
                  clearable
                  default-first-option
                  @change="handlerSelect"
                >
                  <el-option
                    v-for="itemsS in status"
                    :key="itemsS.dictId"
                    :label="itemsS.dictName"
                    :value="itemsS.dictId"
                  ></el-option>
                </el-select>
                <span class="orderStyle_text">
                  订单状态：待备货、已备货、待发货、待签收。"待发货"状态里面有拣货单导出、导出物流数据、导出物流单号。
                </span>
              </el-form-item>
              <el-form size="mini">
                <el-form-item label="平台分类">
                  <el-select
                    v-model="queryForm.platformType"
                    placeholder="选择平台分类"
                    multiple
                    clearable
                  >
                    <el-option
                      v-for="itemsS in platform"
                      :key="itemsS.dictId"
                      :value="itemsS.dictId"
                      :label="itemsS.dictName"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-form>
            </el-form>
          </div>

          <el-form-item label="姓名/手机号">
            <el-input
              placeholder="请输入客户手机号码/姓名"
              v-model="queryForm.customerKeyWord"
            ></el-input>
          </el-form-item>

          <el-form-item label="订单编号">
            <el-input
              v-model="queryForm.orderNo"
              placeholder="请输入订单编号"
            ></el-input>
          </el-form-item>

          <div class="selectDate">
            <span>付款时间</span>
            <div class="picker">
              <!-- :picker-options="pickerOptions" -->
              <el-date-picker
                v-model="date"
                type="daterange"
                unlink-panels
                range-separator="至"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd"
                @input="immediUpdate"
              >
              </el-date-picker>
            </div>
          </div>
          <el-form-item label="部门选择">
            <el-cascader
              v-model="queryForm.orgName"
              :options="options"
              :props="{
                multiple: true,
                checkStrictly: true,
                label: 'orgName',
                value: 'orgCode',
                children: 'children',
              }"
            ></el-cascader>
          </el-form-item>
          <el-form-item label="客服">
            <el-select
              v-model="queryForm.service"
              filterable
              clearable
              placeholder="请选择客服"
              :default-first-option="true"
            >
              <el-option
                v-for="items in customer"
                :key="items.id"
                :label="items.reallyName"
                :value="items.id"
              ></el-option>
            </el-select>
          </el-form-item>
          <div class="selectDate">
            <span>备货时间</span>
            <div class="picker">
              <el-date-picker
                v-model="date1"
                type="daterange"
                unlink-panels
                range-separator="至"
                start-placeholder="起始时间"
                end-placeholder="结束时间"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd"
              >
              </el-date-picker>
            </div>
          </div>
          <div class="selectDate">
            <span>发货时间</span>
            <div class="picker">
              <!-- :picker-options="pickerOptions" -->
              <el-date-picker
                v-model="date2"
                type="daterange"
                unlink-panels
                range-separator="至"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd"
                @input="immediUpdate"
              >
              </el-date-picker>
            </div>
          </div>
          <el-form-item>
            <el-button
              size="mini"
              type="primary"
              @click="searchEvent"
              v-on:keyup.enter="searchEvent"
              >搜索</el-button
            >
            <el-button size="mini" plain @click="reset">重置</el-button>
          </el-form-item>
        </el-form>
      </div>
    </el-collapse-transition>
    <div class="boxBtns">
      <div class="btnSh">
        <el-button
          type="primary"
          size="mini"
          v-if="
            this.queryForm.orderStatus == 1 || this.queryForm.orderStatus == 4
          "
          @click="approval"
          >批量审核</el-button
        >
        <el-button
          type="success"
          size="mini"
          v-if="this.queryForm.orderStatus == 2"
          @click="physical"
          >拣货单导出</el-button
        >
        <el-button
          type="warning"
          size="mini"
          v-if="this.queryForm.orderStatus == 2"
          @click="exportData"
          >导出物流数据</el-button
        >
        <el-button
          type="danger"
          size="mini"
          v-if="this.queryForm.orderStatus == 2"
          @click="leadingIn = true"
          >导入物流单号</el-button
        >
      </div>
      <el-button type="primary" size="mini" @click="show3 = false" v-if="show3"
        >搜索展开</el-button
      >
    </div>
    <div class="table" @click="allIfreamHide">
      <vxe-table
        style="min-height: 400px"
        class="xtable"
        ref="xtable"
        size="small"
        :data="dataList"
        :expand-config="{ expandAll: true }"
        :sort-config="{ trigger: 'cell' }"
        align="center"
        @checkbox-all="selectAllEvent"
        @checkbox-change="selectChangeEvent"
      >
        <vxe-table-column type="checkbox" width="40"></vxe-table-column>
        <vxe-table-column type="seq" title="序号" width="55"></vxe-table-column>
        <vxe-table-column title="订单编号" min-width="120px">
          <template slot-scope="props">
            <el-tooltip
              class="item"
              effect="dark"
              content="单击复制"
              placement="top"
            >
              <div
                style="cursor: pointer"
                @click="copyButton(props.row.orderNo)"
              >
                <span> {{ props.row.orderNo }}</span>
              </div>
            </el-tooltip>
          </template>
        </vxe-table-column>
        <vxe-table-column title="收货人姓名" min-width="120">
          <template slot-scope="props">
            <p @click="tosee(props.row)" style="cursor: pointer">
              {{ props.row.receiptName }}
            </p>
          </template>
        </vxe-table-column>
        <vxe-table-column title="收货人电话" min-width="120">
          <template slot-scope="props">
            {{ props.row.receiptPhone }}
          </template>
        </vxe-table-column>
        <vxe-table-column title="平台分类" min-width="120">
          <template slot-scope="props">
            {{
              props.row.platformType == 1
                ? "宜关小程序"
                : "" || props.row.platformType == 2
                ? "天兰小程序"
                : "" || props.row.platformType == 3
                ? "九航云选小程序"
                : "" || props.row.platformType == 4
                ? "九航云选APP"
                : "" || props.row.platformType == 5
                ? "五域创客"
                : "" || props.row.platformType == 6
                ? "九航大健康"
                : ""
            }}
          </template>
        </vxe-table-column>
        <vxe-table-column title="订单状态" min-width="120">
          <template slot-scope="props">
            <p style="color: red">
              {{
                props.row.orderStatus == 1
                  ? "待备货"
                  : "" || props.row.orderStatus == 2
                  ? "待发货"
                  : "" || props.row.orderStatus == 3
                  ? "待签收"
                  : "" || props.row.orderStatus == 4
                  ? "已备货"
                  : ""
              }}
            </p>
            <!-- <p>{{}}</p> -->
          </template>
        </vxe-table-column>
        <vxe-table-column title="商品名称" min-width="120">
          <template slot-scope="props">
            <p v-for="item in props.row.orderInfoList" :key="item.value">
              {{ item.productName }}
            </p>
          </template>
        </vxe-table-column>
        <vxe-table-column title="商品数量" min-width="120">
          <template slot-scope="props">
            <p v-for="item in props.row.orderInfoList" :key="item.value">
              {{ item.productNum }}
            </p>
          </template>
        </vxe-table-column>
        <vxe-table-column title="金额" min-width="120">
          <template slot-scope="props">
            <p>支付：￥{{ props.row.payAmount }}</p>
            <p>已收：￥{{ props.row.receivedAmount }}</p>
            <p>待收：￥{{ props.row.waitAmount }}</p>
            <p>优惠：￥{{ props.row.preferentialAmount }}</p>
          </template>
        </vxe-table-column>
        <vxe-table-column title="收货信息" min-width="160">
          <template slot-scope="props">
            {{ props.row.receiptAddress }}
          </template>
        </vxe-table-column>
        <vxe-table-column title="备注" min-width="160">
          <template slot-scope="props">
            {{ props.row.remark }}
          </template>
        </vxe-table-column>
        <vxe-table-column
          title="付款时间"
          width="90"
          field="payTime"
        ></vxe-table-column>
        <vxe-table-column
          title="发货时间"
          width="90"
          field="dispatchTime"
        ></vxe-table-column>
        <vxe-table-column
          title="备货时间"
          width="90"
          field="readyTime"
        ></vxe-table-column>
        <!-- updatedTime  fixed="right"-->
        <vxe-table-column title="操作" fixed="right" min-width="200">
          <template slot-scope="props">
            <div class="btn">
              <!-- 待付款 -->
              <div
                v-if="
                  props.row.platformType == 5 &&
                  props.row.orderStatus != 3 &&
                  props.row.orderStatus != 2
                "
              >
                <span @click="ratify(props.row, 1)">批准</span>
                <span @click="fixOrder(props.row, 2)">办理</span>
              </div>
              <div
                v-if="
                  (props.row.orderStatus == 3 || props.row.orderStatus == 2) &&
                  props.row.platformType == 5
                "
              >
                <span style="color: #bbb; cursor: no-drop">该状态无需审批</span>
              </div>
              <span
                style="color: #bbb; cursor: no-drop"
                v-if="props.row.platformType != 5"
                >该平台仅支持批量操作</span
              >
              <!-- 待付款 -->
              <!-- 关闭 -->
            </div>
          </template>
        </vxe-table-column>
      </vxe-table>
      <div style="height: 40px"></div>
    </div>
    <!-- 分页start -->
    <div class="page">
      <div class="block">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currentPage1"
          :page-sizes="[10, 20, 50, 100]"
          :page-size="pageSize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="totalNum"
          prev-text="上一页"
          next-text="下一页"
        >
        </el-pagination>
      </div>
    </div>
    <!-- 分页end -->
    <el-dialog
      :visible.sync="dowith"
      :append-to-body="true"
      @close="textarea = ''"
      title="办理"
    >
      <span style="display: inline-block; line-height: 30px">审批意见:</span>
      <el-input
        type="textarea"
        placeholder="请输入内容"
        v-model="textarea"
      ></el-input>
      <div slot="footer" class="dialog-footer">
        <!-- 经理审批 组长提交 ； 组长批准直接到物流-->
        <!-- <el-button type="primary" v-if='activeName!=6 && activeName!=5'  @click="dowith = false;approval('经理审批')">经理审批</el-button> -->
        <el-button
          type="primary"
          @click="
            dowith = false;
            approval('批准');
          "
          >批 准</el-button
        >
        <el-button
          type="info"
          @click="
            dowith = false;
            approval('驳回');
          "
          >驳 回</el-button
        >
        <el-button @click="dowith = false">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 对话弹框 -->
    <el-dialog
      :visible.sync="dialogFormVisible"
      :append-to-body="true"
      title="审核过程"
    >
      <el-table :data="polliing" style="width: 100%">
        <el-table-column type="index" label="步骤" width="50"></el-table-column>
        <el-table-column
          label="任务节点"
          prop="taskName"
          :show-overflow-tooltip="true"
        ></el-table-column>
        <el-table-column
          label="办理人"
          prop="assignee"
          width="110"
        ></el-table-column>
        <el-table-column
          label="审批开始时间"
          prop="startTime"
        ></el-table-column>
        <el-table-column label="审批结束时间">
          <template slot-scope="props">
            <span v-if="!is_null(props.row.endTime)">{{
              props.row.endTime
            }}</span>
            <span v-if="is_null(props.row.endTime)">正在处理中...</span>
          </template>
        </el-table-column>
        <el-table-column label="审批意见" :show-overflow-tooltip="true">
          <template slot-scope="props">
            <span v-if="!is_null(props.row.comment)">{{
              props.row.comment
            }}</span>
            <span v-if="is_null(props.row.comment)">/</span>
          </template>
        </el-table-column>
      </el-table>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 对话弹框 -->
    <!-- 物流单号导入 -->
    <el-dialog
      :visible.sync="leadingIn"
      :append-to-body="true"
      width="21%"
      title="物流单号导入"
    >
      <div class="popIn">
        <el-upload
          class="upload-demo"
          drag
          action="#"
          :multiple="false"
          :http-request="orderImport"
          :limit="1"
          ref="my-upload"
        >
          <i class="el-icon-upload"></i>
          <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
        </el-upload>
        <!-- <el-checkbox style="margin-top: 10px"
                             v-model="checked">是否更新已经存在的物流单号的数据</el-checkbox> -->
        <!-- <span style="margin-left: 10px; display: inline-block; ">下载模板</span> -->
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button
          size="mini"
          @click="
            leadingIn = false;
            DownloadTemplate();
          "
          >下载模板</el-button
        >
        <el-button
          size="mini"
          @click="
            leadingIn = false;
            popInAxios(1);
          "
          >批量暂存</el-button
        >
        <el-button
          type="primary"
          size="mini"
          @click="
            leadingIn = false;
            popInAxios(0);
          "
          >批量发货</el-button
        >
        <el-button @click="cancel" size="mini">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 物流单号导入 -->
    <!-- 物流订单号追踪节点 -->
    <el-dialog
      :visible.sync="logisPoper"
      :append-to-body="true"
      title="物流查询详情"
    >
      <div v-if="logistlist.base64T === undefined">
        <p class="logHeader">
          <!-- {{logistlist.logo}} -->
          <!-- <img :src="logistlist.logo" alt="" class="images" /> -->
          <!-- <el-image :src="logistlist.logo" alt="" fit="contain">
          <div slot="error" class="image-slot">
            <i class="el-icon-picture-outline"></i>
          </div>
        </el-image> -->
          <span>{{ logistlist.expTextName }}</span>
          <span>{{ logistlist.mailNo }}</span>
        </p>
        <div v-if="logistlist.status != 1" class="trackingNode">
          <el-steps direction="vertical" :active="0">
            <el-step
              v-for="(pre, index) in logistlist.data"
              :key="index"
              class="stepSuc"
              style="flex-grow: 1; min-height: 80px"
              :title="'审批人' + pre.context"
              :description="pre.time"
            />
          </el-steps>
        </div>
        <span
          style="font-weight: 600; font-size: 18px"
          v-if="logistlist.status == 1"
          >提示暂未查询到物流信息</span
        >
      </div>
      <div
        style="
          display: flex;
          flex-direction: column;
          align-items: center;
          height: 400px;
          overflow: auto;
        "
        v-else
      >
        <div style="font-size: 20px; font-weight: 600">
          {{ logistlist.name + "    " + logistlist.id }}
        </div>
        <div>
          <img :src="'data:image/png;base64,' + logistlist.base64T" />
        </div>
      </div>
    </el-dialog>
    <!-- 物流订单号追踪节点 -->
    <!-- 单个订单货 -->
    <el-dialog
      :visible.sync="delivery"
      :append-to-body="true"
      title="填写出库信息"
    >
      <div class="aloneDeliveryHouse">
        <div class="line" style="display: flex; justify-content: flex-start">
          <p>
            <span>出库仓库</span>
            <!-- @change="currentWouseGoods" -->
            <el-select
              v-model="logist.wareOut"
              filterable
              placeholder="请选择出库仓库(选填)"
              clearable
            >
              <el-option
                v-for="items in warelist"
                :key="items.id"
                :label="items.name + '-(' + items.keeper + ')'"
                :value="items.id"
              ></el-option>
            </el-select>
          </p>
        </div>
        <div class="line" style="display: flex; justify-content: flex-start">
          <p>
            <span>物流公司</span>
            <el-select
              v-model="logist.name"
              placeholder="物流公司"
              filterable
              clearable
            >
              <el-option
                v-for="itemsS in companys"
                :key="itemsS.dictName"
                :label="itemsS.dictName"
                :value="itemsS.dictName"
              ></el-option>
            </el-select>
          </p>
          <p>
            <span>物流单号</span>
            <el-input
              v-model="logist.number"
              placeholder="请填写物流单号"
            ></el-input>
          </p>
        </div>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button size="mini" type="primary" @click="orderTS"
          >单号暂存</el-button
        >
        <el-button
          size="mini"
          type="primary"
          @click="
            delivery = false;
            deliveryTrue();
          "
          >确 定</el-button
        >
        <el-button size="mini" @click="delivery = false">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 单个订单货 -->
    <!-- 修改价格 -->
    <el-dialog
      :visible.sync="modify"
      :append-to-body="true"
      title="修改代收价格"
    >
      <div class="aloneDelivery">
        <p>
          <span>订单编号：</span>
          <span>{{ modifyPrice.orderIdStr }}</span>
        </p>
        <p>
          <span>总金额: </span>
          <span>￥{{ modifyPrice.money }}</span>
        </p>
        <p>
          <span>已收金额：</span>
          <span>￥{{ modifyPrice.receivedMoney }}</span>
        </p>
        <p>
          <span>剩余代付金额：</span>
          <span>￥{{ modifyPrice.awaitIncomeMoney }}</span>
        </p>
        <p>
          <span>待收金额</span>
          <el-input v-model="moneyWait" placeholder="请填写待收金额"></el-input>
        </p>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="waitLogiterMoney()">确 定</el-button>
        <el-button @click="modify = false">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 修改价格 -->
    <!-- 修改快递单号 -->
    <el-dialog :visible.sync="updateOddVis" append-to-body title="修改快递单号">
      <div class="fixNumber">
        <!-- 快递公司
				<el-input style="width:200px;" v-model="updateOddObj.logisticsCompany" placeholder="请输入新的快递公司"></el-input> -->
        <!-- <p> -->
        <span>物流公司</span>
        <el-select
          v-model="updateOddObj.logisticsCompany"
          placeholder="物流公司"
          filterable
          clearable
        >
          <el-option
            v-for="itemsS in companys"
            :key="itemsS.dictName"
            :label="itemsS.dictName"
            :value="itemsS.dictName"
          ></el-option>
        </el-select>
        <!-- </p> -->
      </div>
      <div class="fixNumber">
        <span>快递单号</span>
        <el-input
          style="width: 200px; margin-top: 20px"
          v-model="updateOddObj.parcelNumber"
          placeholder="请输入新的快递单号"
        ></el-input>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" size="small" @click="updateOdd"
          >确 定</el-button
        >
        <el-button type="info" size="small" plain @click="updateOddVis = false"
          >取 消</el-button
        >
      </div>
    </el-dialog>

    <!-- 批准 -->
    <el-dialog
      :title="headerTitle"
      :visible.sync="dialogOperation"
      width="30%"
      :before-close="handleCloseOperation"
      append-to-body
    >
      <el-form>
        <el-form-item label="审批意见">
          <el-input type="textarea" v-model="comment"></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="turnDown">驳回</el-button>
        <el-button type="primary" @click="approve">批准</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import levelAddr from '@/components/levelAddr'
import $ from 'jquery'
import Vue from 'vue'
export default {
  components: {
    levelAddr,
  },
  data () {
    return {
      headerTitle: "",//弹框标题
      dialogOperation: false,
      dataList: [],
      totalNum: 0,
      Administrator: '',
      authority: '',
      //导出日期限制
      // pickerOptions: {
      //     disabledDate(time) {
      //         // 获取当前月的第一天
      //         function getCurrentMonthFirst() {
      //             var date = new Date()
      //             date.setDate(0)
      //             return date
      //         }
      //         // 获取当前月的最后一天
      //         function getCurrentMonthLast() {
      //             var date = new Date()
      //             var currentMonth = date.getMonth()
      //             var nextMonth = ++currentMonth
      //             var nextMonthFirstDay = new Date(
      //                 date.getFullYear(),
      //                 nextMonth,
      //                 1
      //             )
      //             var oneDay = 1000 * 60 * 60 * 24
      //             return new Date(nextMonthFirstDay - oneDay)
      //         }
      //         return (
      //             getCurrentMonthFirst() > time.getTime() ||
      //             time.getTime() > getCurrentMonthLast()
      //         )
      //     },
      // },
      show3: false,
      updateOddVis: false,
      updateOddObj: {},
      checked: false, //物流选择
      logFile: '',
      logisticsCont: '', //获取部门下拉框数据
      activeName: '-1',
      user_id: sessionStorage.getItem('user_id'),
      date: [],
      date1: [],
      date2: [],
      expends: [],
      queryForm: {
        customerKeyWord: '',//客户名称或手机号
        orderNo: '',//平台订单号
        orderStatus: 1,//订单状态
        platformType: null,//平台类型
        startPayTime: null,//付款开始时间
        endPayTime: null,//付款结束时间
        startReadyTime: null,//备货开始时间
        endReadyTime: null,//备货结束时间
        startDispatchTime: null,//发货开始时间
        endDispatchTime: null,//发货结束时间
        orgName: '',//部门选择
        service: null,//客服
      },
      loginsId: '',
      currentPage1: 1,
      pageSize: 10,
      dialogFormVisible: false,
      leadingIn: false, //物流导入弹框
      tableData: [],
      expandRowKeys: [],
      customer: [],
      dowith: false,
      textarea: '',
      taskId: '',
      orderIds: '',
      polliing: [],
      status: [{
        dictId: 1,
        dictName: "待备货"
      },
      {
        dictId: 4,
        dictName: "已备货"
      },
      {
        dictId: 2,
        dictName: "待发货"
      },
      {
        dictId: 3,
        dictName: "待签收"
      },
      ], //订单类型
      platform: [{
        dictId: 1,
        dictName: "宜关小程序"
      },
      {
        dictId: 2,
        dictName: "天兰小程序"
      },
      {
        dictId: 3,
        dictName: "九航云选小程序"
      },
      {
        dictId: 4,
        dictName: "九航云选APP"
      },
      {
        dictId: 5,
        dictName: "五域创客"
      },
      {
        dictId: 6,
        dictName: "九航大健康"
      },],//平台分类
      beginTime: '',
      endTime: '',
      multipleSelection: [],
      salesAuthorityId: JSON.parse(
        sessionStorage.getItem('salesAuthorityId')
      ),
      logistlist: {},
      logisPoper: false,
      limits: '',
      parArray: [],
      delivery: false, //单个发货
      logist: {
        name: '',
        number: '',
        chargeName: '', // 仓库负责人
        deliveryNo: '', // 出库单号
        handler: '', // 经手人
        wareOut: '', // 出库仓库
      },
      options: [],
      logId: '', //获取的id
      modify: false,
      loading: false,
      modifyPrice: '', //接收数据
      moneyWait: '', //待收金额赋值
      warelist: [],
      height: '500px',
      companys: [],
      ifreamDom: [],
      leadingInLive: false,
      ImportLove: false,
      dialogState: "",
      comment: "",//审批意见
      turnDownId: "",//驳回ID
      approveId: "",//批准ID
    }
  },
  created () {
    // 查询订单统计列表
    // this.getOrderList()
    this.defaultDate()
    this.searchEvent()
    // this.defaultDate()//这是时间选择默认时间
    this.authority = sessionStorage.getItem('role')
    this.Administrator = JSON.parse(
      sessionStorage.getItem('userInfo')
    ).userType
    console.log(this.Administrator)
    // 权限设定判断
    this.limits = JSON.parse(sessionStorage.getItem('limit'))
    const params = this.limits.buttonTreeDto.filter(
      (item) => item.menuCode === 'orderListCode'
    )
    params[0].buttonList.forEach((item) => {
      this.parArray.push(item.code)
    })
    // 权限设定判断
    this.customerlist()
    this.department()
    this.wareHouse()
    if (
      this.salesAuthorityId == 2 &&
      sessionStorage.getItem('positionCode') != 'manager'
    ) {
      //判断是否默认选中客户
      this.queryForm.service = JSON.parse(
        sessionStorage.getItem('user_id')
      )
    } else {
      this.queryForm.service = null
    }

    //微商1 客服2
    if (!this.is_null(this.$route.query.activeName)) {
      this.activeName = this.$route.query.activeName
    } else if (!this.is_null(sessionStorage.getItem('activeName'))) {
      this.activeName = sessionStorage.getItem('activeName') //this.$route.query.activeName;
    } else {
      this.activeName = '-1'
    }
    // console.log(this.activeName)
    // if((this.salesAuthorityId==2 && this.parArray.indexOf("dfkOrder")!=-1) || (this.salesAuthorityId=='' && this.parArray.indexOf("dfkOrder")!=-1)){
    // this.activeName = "0";
    // 		this.orderPaid(1);//待付款
    // }else if(this.salesAuthorityId == 1 && this.activeName=="1"){
    // this.listAxios(1);
    // }


    let _this = this
    document.onkeydown = function (e) {
      let key = window.event.keyCode
      if (key == 13) {
        _this.searchEvent()
      }
    }
    console.log(this.date)
  },
  beforeRouteLeave (to, form, next) {
    document.onkeydown = null
    next()
  },
  activated () {
    this.customerlist()
    this.department()
    this.wareHouse()
    if (!this.is_null(this.$route.query.activeName)) {
      this.activeName = this.$route.query.activeName
    } else if (!this.is_null(sessionStorage.getItem('activeName'))) {
      this.activeName = sessionStorage.getItem('activeName') //this.$route.query.activeName;
    }


  },
  beforeRouteLeave (to, from, next) {
    this.allIfreamHide()
    next()
  },
  watch: {
    leadingIn (old) {
      console.log(old)
      if (old == false) {
        this.$refs['my-upload'].clearFiles();
      }
    }
  },
  methods: {

    cancel () {
      this.leadingIn = false;
      this.$refs['my-upload'].clearFiles();
    },

    // 下载模板
    DownloadTemplate () {
      this.downloadlink('http://120.24.147.235:7777/%E4%BA%94%E5%9F%9F%E8%AE%A2%E5%8D%95%E7%BB%9F%E8%AE%A1%E5%AF%BC%E5%85%A5%E5%8D%95%E5%8F%B7%E6%A8%A1%E6%9D%BF.xlsx')
    },
    // 驳回按钮
    turnDown () {
      // 如果点的批准操作的驳回
      console.log(this.turnDownId, "弹窗批准")
      this.axios.post('/order/sync/order/approve', {
        orderId: this.turnDownId,
        status: 2,
        comment: this.comment
      }).then(res => {
        console.log(res)
        if (res.code == 0) {
          this.$message.warning(res.message)
          this.dialogOperation = false
          this.getOrderList()

        } else {
          this.$message.error(res.message)
          this.dialogOperation = false
        }
      })

    },
    // 批准按钮
    approve () {
      console.log(this.turnDownId, "弹窗办理")
      this.axios.post('/order/sync/order/approve', {
        orderId: this.turnDownId,
        status: 1,
        comment: this.comment
      }).then(res => {
        if (res.code == 0) {
          this.$message.warning(res.message)
          this.dialogOperation = false
          this.getOrderList()
        } else {
          this.$message.error(res.message)
          this.dialogOperation = false
        }
      })

    },
    handleCloseOperation () {
      this.dialogOperation = false;
    },
    // 默认当天时间
    defaultDate () {
      //获取新的时间
      let date = new Date()
      //获取当前时间的年份转为字符串
      let year = date.getFullYear().toString()
      //获取月份，由于月份从0开始，此处要加1，判断是否小于10，如果是在字符串前面拼接'0'
      let month =
        date.getMonth() + 1 < 10
          ? '0' + (date.getMonth() + 1).toString()
          : (date.getMonth() + 1).toString()
      //获取天，判断是否小于10，如果是在字符串前面拼接'0'
      let da =
        date.getDate() < 10
          ? '0' + date.getDate().toString()
          : date.getDate().toString()
      //字符串拼接，开始时间，结束时间
      let end = year + '-' + month + '-' + da //当天
      let beg = year + '-' + month + '-' + da //当月第一天
      this.date = [beg, end] //将值设置给插件绑定的数据
    },
    // 物流导单
    physical () {
      if (this.date != undefined && this.date != "") {
        this.queryForm.startPayTime = this.date[0] + ' 00:00:00'
        this.queryForm.endPayTime = this.date[1] + ' 23:59:59'
      } else {
        this.queryForm.startPayTime = ''
        this.queryForm.endPayTime = ''
      }
      if (this.date1 != undefined && this.date1 != "") {
        this.queryForm.startReadyTime = this.date1[0] + ' 00:00:00'
        this.queryForm.endReadyTime = this.date1[1] + ' 23:59:59'
      } else {
        this.queryForm.startReadyTime = ''
        this.queryForm.endReadyTime = ''
      }
      if (this.date2 != undefined && this.date2 != "") {
        this.queryForm.startDispatchTime = this.date2[0] + ' 00:00:00'
        this.queryForm.endDispatchTime = this.date2[1] + ' 23:59:59'
      } else {
        this.queryForm.startDispatchTime = ''
        this.queryForm.endDispatchTime = ''
      }
      this.axios.post('/order/sync/order/logistics/export', {
        customerKeyWord: this.queryForm.customerKeyWord,//客户名称或手机号
        orderNo: this.queryForm.orderNo,//平台订单号
        orderStatus: this.queryForm.orderStatus,//订单状态
        platformTypeList: this.queryForm.platformType,//平台类型
        startPayTime: this.queryForm.startPayTime,//付款开始时间
        endPayTime: this.queryForm.endPayTime,//付款结束时间
        startReadyTime: this.queryForm.startReadyTime,//备货开始时间
        endReadyTime: this.queryForm.endReadyTime,//备货结束时间
        startDispatchTime: this.queryForm.startDispatchTime,//发货开始时间
        endDispatchTime: this.queryForm.endDispatchTime,//发货结束时间
        userIdList: [this.queryForm.service],
      }).then(res => {
        if (res.code == 0) {
          this.downloadlink(res.data)
        } else {
          this.$message.error(res.message)
        }
      })
    },
    // 导出数据
    exportData () {
      if (this.date != undefined && this.date != "") {
        this.queryForm.startPayTime = this.date[0] + ' 00:00:00'
        this.queryForm.endPayTime = this.date[1] + ' 23:59:59'
      } else {
        this.queryForm.startPayTime = ''
        this.queryForm.endPayTime = ''
      }
      if (this.date1 != undefined && this.date1 != "") {
        this.queryForm.startReadyTime = this.date1[0] + ' 00:00:00'
        this.queryForm.endReadyTime = this.date1[1] + ' 23:59:59'
      } else {
        this.queryForm.startReadyTime = ''
        this.queryForm.endReadyTime = ''
      }
      if (this.date2 != undefined && this.date2 != "") {
        this.queryForm.startDispatchTime = this.date2[0] + ' 00:00:00'
        this.queryForm.endDispatchTime = this.date2[1] + ' 23:59:59'
      } else {
        this.queryForm.startDispatchTime = ''
        this.queryForm.endDispatchTime = ''
      }
      this.axios.post('/order/sync/order/export/data', {
        customerKeyWord: this.queryForm.customerKeyWord,//客户名称或手机号
        orderNo: this.queryForm.orderNo,//平台订单号
        orderStatus: this.queryForm.orderStatus,//订单状态
        platformTypeList: this.queryForm.platformType,//平台类型
        startPayTime: this.queryForm.startPayTime,//付款开始时间
        endPayTime: this.queryForm.endPayTime,//付款结束时间
        startReadyTime: this.queryForm.startReadyTime,//备货开始时间
        endReadyTime: this.queryForm.endReadyTime,//备货结束时间
        startDispatchTime: this.queryForm.startDispatchTime,//发货开始时间
        endDispatchTime: this.queryForm.endDispatchTime,//发货结束时间
        userIdList: [this.queryForm.service],
      }).then(res => {
        if (res.code == 0) {
          this.downloadlink(res.data)
        } else {
          this.$message.error(res.message)
        }
      })
    },

    // 批准
    ratify (row, e) {
      console.log(row)
      this.turnDownId = row.id
      console.log(this.turnDownId, "批准")
      this.headerTitle = "批准"
      this.dialogOperation = true
      this.comment = ""
      this.dialogState = e
      // let array = []
      // if(this.is_null(row)){
      //     for(let i = 0;i<this.multipleSelection.length;i++){
      //         array.push(this.multipleSelection[i])
      //     }
      // }
      // console.log(e)
    },
    // 办理
    fixOrder (row, e) {
      console.log(row)
      this.turnDownId = row.id
      console.log(this.approveId, "办理")
      this.headerTitle = "办理"
      this.dialogOperation = true
      this.comment = ""
      this.dialogState = e
    },
    // 查询订单统计列表
    getOrderList () {
      let data = []
      if (this.queryForm.orgName) {
        this.queryForm.orgName.forEach(item => {
          console.log(item)
          data.push(item[item.length - 1])
        })

      }

      this.axios.post("/order/sync/order/find/base/list", {
        orgCodeList: data.length == 0 ? null : data,
        customerKeyWord: this.queryForm.customerKeyWord,//客户名称或手机号
        orderNo: this.queryForm.orderNo,//平台订单号
        orderStatus: this.queryForm.orderStatus,//订单状态
        platformTypeList: this.queryForm.platformType,//平台类型
        startPayTime: this.queryForm.startPayTime,//付款开始时间
        endPayTime: this.queryForm.endPayTime,//付款结束时间
        startReadyTime: this.queryForm.startReadyTime,//备货开始时间
        endReadyTime: this.queryForm.endReadyTime,//备货结束时间
        startDispatchTime: this.queryForm.startDispatchTime,//发货开始时间
        endDispatchTime: this.queryForm.endDispatchTime,//发货结束时间
        userIdList: [this.queryForm.service],
        pageNo: this.currentPage1,
        pageSize: this.pageSize,
      }).then(res => {
        console.log(res)
        this.dataList = res.data.records
        this.totalNum = res.data.total
      })
    },
    // //设置默认日期
    // defaultDate() {
    //     //获取新的时间
    //     let date = new Date()
    //     //获取当前时间的年份转为字符串
    //     let year = date.getFullYear().toString()
    //     //获取月份，由于月份从0开始，此处要加1，判断是否小于10，如果是在字符串前面拼接'0'
    //     let month =
    //         date.getMonth() + 1 < 10
    //             ? '0' + (date.getMonth() + 1).toString()
    //             : (date.getMonth() + 1).toString()
    //     //获取天，判断是否小于10，如果是在字符串前面拼接'0'
    //     let da =
    //         date.getDate() < 10
    //             ? '0' + date.getDate().toString()
    //             : date.getDate().toString()
    //     //字符串拼接，开始时间，结束时间
    //     let end = year + '-' + month + '-' + da //当天
    //     let beg = year + '-' + month + '-' + da //当月第一天
    //     this.date = [beg, end] //将值设置给插件绑定的数据
    // },
    // 月间计算
    duringMonth (time) {
      let result = ''
      let beginTime = time[0]
      let endTime = time[1]
      let yearS = new Date(beginTime).getFullYear()
      let yearE = new Date(endTime).getFullYear()
      let monthS = new Date(beginTime).getMonth() + 1
      let monthE = new Date(endTime).getMonth() + 1
      // 同年
      if (yearS == yearE) {
        if (monthE - monthS > 3) {
          this.$message.warning(
            '因数据量过大，请选择三个月范围内的数据，进行导表'
          )
          result = false
        } else {
          result = true
        }
      } else {
        if (yearE - yearS > 1) {
          this.$message.warning('请选择三个月范围内的数据，进行导表')
          result = false
        } else if (yearE - yearS == 1) {
          if (yearE + 12 - yearS + 12 > 3) {
            this.$message.warning(
              '请选择三个月范围内的数据，进行导表'
            )
            result = false
          } else {
            result = true
          }
        } else {
          this.$message.warning('请选择三个月范围内的数据，进行导表')
          result = false
        }
      }
      return result
    },
    getOrderSum () {
      this.axios
        .get('/order/order/return/taskNumber', { isLoading: false })
        .then((res) => {
          this.$store.dispatch('addOrderCount', res.data)
        })
    },

    orderTS () {
      this.axios
        .post('/order/logistics/workingParcelNumber', {
          request: {
            logisticsCompany: this.logist.name,
            orderId: this.logId,
            parcelNumber: this.logist.number,
          },
        })
        .then((res) => {
          if (res.code == 0) {
            this.delivery = false
            this.backOrder()
            this.$message.success('暂存成功')
          } else {
            this.$message.error(res.message)
          }
        })
    },
    allIfreamHide () {
      $('.parcelNumberBorder').hide()
    },
    // warHide: _.debounce(function(e) {
    //   $("#" + e).hide();
    // }, 500),
    test: function (t, e) {
      $('.parcelNumberBorder').hide()
      this.loginsId = e.logisticsOrder.parcelNumber
      let temp = false
      this.ifreamDom.forEach((res) => {
        if (res == e.logisticsOrder.parcelNumber) {
          temp = true
        }
      })
      let te = document.getElementById(
        'ts' + e.logisticsOrder.parcelNumber
      )
      if (!temp) {
        let loading = this.$loading({
          lock: true,
          text: '加载中...',
          spinner: 'el-icon-loading',
          background: 'rgba(0, 0, 0, 0.7)',
        })
        setTimeout((st) => {
          loading.close()
        }, 5000)

        $.get(
          'http://120.24.147.235/123?id=' +
          e.logisticsOrder.parcelNumber,
          (res) => {
            if (res.code == 0) {
              this.ifreamDom.push(e.logisticsOrder.parcelNumber)
              $('#ts' + e.logisticsOrder.parcelNumber)
                .append(`<div class="parcelNumberBorder" id="${e.logisticsOrder.parcelNumber
                  }" style="padding:10px;background: #E2E2E2;border-radius: 10px;position: absolute;top: 10px;right:120px;z-index:999;"><div style="overflow-x: hidden;height:400px;">
              <div style="font-size:20px;font-weight:600;padding-bottom:10px;background:#fff;">${e.logisticsOrder.logisticsCompany +
                  ' ' +
                  e.logisticsOrder.parcelNumber
                  }</div>
              <img  src="data:image/png;base64,${res.message}">
              </div>
              <div style="width:0;height:0;border:12px solid transparent;border-left:12px solid #E2E2E2;position: absolute;
              top: 30px;
    right: -24px;"></div></div>`)
              loading.close()
            } else {
              loading.close()
              this.$message.error(res.message)
            }
          }
        )
      } else {
        if (
          $('#' + e.logisticsOrder.parcelNumber)[0] &&
          $('#' + e.logisticsOrder.parcelNumber)[0].style.display ==
          'none'
        ) {
          $('#' + e.logisticsOrder.parcelNumber).show()
        } else {
          $('#' + e.logisticsOrder.parcelNumber).hide()
        }
      }
    },
    // 清空日期
    immediUpdate (e) {
      this.$nextTick(() => {
        if (e == null) {
          this.beginTime = ''
          this.endTime = ''
        } else {
          this.$set(this, 'date', [e[0], e[1]])
        }
      })
    },
    loginsIdHide (e) {
      // console.log(e)
      // document.getElementById(e).style.display = "none";
    },
    loginsIdClick (e) {
      this.loginsId = e
      // this.$nextTick(() => {
      // 	document.getElementById(e).style.display = "inline-block";
      // });
    },
    copyButton (param) {
      console.log(param)
      let that = this
      that.$copyText(param).then(
        function (e) {
          that.$message({
            type: 'success',
            message: '成功复制订单编号',
          })
        },
        function (e) {
          that.$message({
            type: 'warning',
            message: '复制失败',
          })
        }
      )
    },

    /**
     * 查询物流快递公司
     **/
    // 重置搜索数据
    reset: _.debounce(function () {
      this.date1 = []
      this.date = []
      this.date2 = []
      this.currentPage1 = 1
      this.pageSize = 10
      this.queryForm = {
        customerKeyWord: '',//客户名称或手机号
        orderNo: '',//平台订单号
        orderStatus: '',//订单状态
        platformType: null,//平台类型
        startPayTime: null,//付款开始时间
        endPayTime: null,//付款结束时间
        startReadyTime: null,//备货开始时间
        endReadyTime: null,//备货结束时间
        startDispatchTime: null,//发货开始时间
        endDispatchTime: null,//发货结束时间
        orgName: "",
        service: null,
      }

      console.log(this.date)


    }, 300),
    // 部门选择列表
    department () {
      this.axios
        .post(
          '/sys/v1/org/tree/select',
          {
            request: {
              orgName: '',
              orgType: '',
            },
            version: '',
          },
          {
            headers: {
              isLoading: false,
            },
          }
        )
        .then((res) => {
          if (res.code == 0) {
            this.options = res.data
          } else {
            this.$message.error(res.message)
          }
        })
    },

    isTableHeight () {
      if (this.tableData.list.length < 3) {
        document.getElementsByClassName(
          'vxe-table--body-wrapper body--wrapper'
        )[0].style = 'overflow: inherit;'
      } else {
        document.getElementsByClassName(
          'vxe-table--body-wrapper body--wrapper'
        )[0].style = ''
      }
    },
    // 待审核数据列表 end//


    //设置table中的扩展项，展开的id，此处我需要全部展开
    getExpends () {
      var Id = this.tableData.list.map((item) => item.orderUser.id)
      this.expends = Id
    },
    // getRowKeys(row) {
    // 	return row.orderUser.id;
    // },

    // 客户签收 &&批量签收
    // 客服下拉框数据
    customerlist () {
      this.axios
        .get(
          '/sys/v1/user/employee/by/sales/authority?salesAuthorityId=' +
          JSON.parse(
            sessionStorage
              .getItem('salesAuthorityId')
              .split(',')
          ),
          {
            headers: {
              isLoading: false,
            },
          }
        )
        .then((res) => {
          ////console.log(res);
          if (res.code == 0) {
            this.customer = res.data
          } else {
            this.$message.error(res.message)
          }
        })
    },
    tosee (row) {
      this.$router.push({
        name: 'orderStatisticsDetail',
        query: {
          id: row.id,
        },
      })
      sessionStorage.setItem('activeName', this.activeName)
    },
    handleCurrentChange (val) {
      this.currentPage1 = val
      this.getOrderList()
      console.log(val)
    },
    handleSizeChange (val) {
      this.pageSize = val
      this.getOrderList()
      console.log(val)

    },
    // 办理按钮
    trueEvent (row) {
      this.dowith = true
      this.taskId = row.orderUser.taskId
      this.orderIds = row.orderUser.orderIdStr
      // this.taskId = row;
    },
    // 关闭订单列表
    closeOrder (pageNo) {
      let beginTime = ''
      let endTime = ''
      if (this.date) {
        beginTime = this.date[0] + ' 00:00:00'
        endTime = this.date[1] + ' 23:59:59'
      }
      this.axios
        .post('/order/order/user/delorderlist', {
          addressName:
            this.queryForm.province +
            this.queryForm.city +
            this.queryForm.area,
          customerId: this.queryForm.service,
          endTime: endTime,
          keyword: this.queryForm.info.trim(),
          orderId: this.queryForm.identifier.trim(),
          orderType: this.queryForm.state,
          pageNo: this.currentPage1,
          pageSize: this.pageSize,
          startTime: beginTime,
          orgCode:
            this.queryForm.orgName[
            this.queryForm.orgName.length - 1
            ],
        })
        .then((res) => {
          if (res.code == 0) {
            ////console.log('关闭订单');
            this.tableData = res.data
            this.isTableHeight()
            //this.getExpends();
          } else {
            this.$message.error(res.message)
            this.tableData = []
          }
        })
    },
    // 批准 //批量审核
    approval (result) {
      let status = ""
      console.log(this.queryForm.orderStatus)
      if (this.queryForm.orderStatus != 4) {
        status = 4
      } else {
        status = 2
      }
      let position = sessionStorage.getItem('positionCode')
      let idList = []
      if (this.multipleSelection.length) {
        for (let i = 0; i < this.multipleSelection.length; i++) {
          idList.push(
            this.multipleSelection[i].id)
        }
      }
      // else if (this.taskId) {
      //     ids.push(this.taskId)
      //     orderIds.push(this.orderIds)
      // }
      else {
        this.$message.warning('未选中需要处理的订单')
        return false
      }
      // console.log(ids)
      if (!this.is_null(idList)) {
        this.$confirm('是否继续此操作?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
        })
          .then(() => {
            this.axios
              .post(
                '/order/sync/order/base/update/status',
                {

                  status: status,
                  idList: idList,
                },
                {
                  timeout: 60000,
                }
              )
              .then((res) => {
                console.log(res);
                if (res.code == 0) {
                  this.$message.success('审核成功')
                  this.getOrderList()
                  this.pageSize = 10
                  this.multipleSelection = []
                  //   }
                } else {
                  this.$message.error(res.message)
                }
              })
          })
          .catch(() => {
            this.$message({
              type: 'info',
              message: '已取消操作',
            })
          })
      } else {
        this.$message.warning('未勾选需要处理的订单')
      }
    },


    handlerSelect (e) {
      this.queryForm.orderStatus = e;
      this.searchEvent()
    },
    // 搜索事件
    searchEvent: _.debounce(function () {
      this.currentPage1 = 1
      //   this.pageSize = 10;
      if (this.date != undefined && this.date != "") {
        this.queryForm.startPayTime = this.date[0] + ' 00:00:00'
        this.queryForm.endPayTime = this.date[1] + ' 23:59:59'
      } else {
        this.queryForm.startPayTime = null
        this.queryForm.endPayTime = null
      }
      if (this.date1 != undefined && this.date1 != "") {
        this.queryForm.startReadyTime = this.date1[0] + ' 00:00:00'
        this.queryForm.endReadyTime = this.date1[1] + ' 23:59:59'
      } else {
        this.queryForm.startReadyTime = null
        this.queryForm.endReadyTime = null
      }
      if (this.date2 != undefined && this.date2 != "") {
        this.queryForm.startDispatchTime = this.date2[0] + ' 00:00:00'
        this.queryForm.endDispatchTime = this.date2[1] + ' 23:59:59'
      } else {
        this.queryForm.startDispatchTime = null
        this.queryForm.endDispatchTime = null
      }
      this.getOrderList()
      // this.axios.post('/order/sync/order/find/base/list',{
      //     pageNo: this.currentPage1,
      //     pageSize: this.pageSize,
      //     customerKeyWord: this.queryForm.customerKeyWord,//客户名称或手机号
      //     orderNo: this.queryForm.orderNo,//平台订单号
      //     orderStatus: this.queryForm.orderStatus,//订单状态
      //     platformType: this.queryForm.platformType,//平台类型
      //     startPayTime: this.queryForm.startPayTime,//付款开始时间
      //     endPayTime: this.queryForm.endPayTime,//付款结束时间
      //     startReadyTime : this.queryForm.startReadyTime,//备货开始时间
      //     endReadyTime: this.queryForm.endReadyTime,//备货结束时间
      //     startDispatchTime: this.queryForm.startDispatchTime,//发货开始时间
      //     endDispatchTime:this.queryForm.endDispatchTime,//发货结束时间
      // }).then(res=>{
      //     console.log(res)
      //     if(res.code == 0){
      //         this.dataList = res.data.records
      //         this.totalNum = res.data.total

      //     }else{
      //         this.$message.error(res.message)
      //     }
      // })

    }, 300),
    // 订单状态
    orderStatus () {
      // 1-运行中 2-已审核 3-所有订单
      let typeId = ''
      if (this.activeName == '2') {
        typeId = 2
      } else if (this.activeName == '3') {
        typeId = 1
      } else if (this.activeName == '-1') {
        typeId = 3
      }

      if (
        this.activeName == '2' ||
        this.activeName == '3' ||
        this.activeName == '-1'
      ) {
        this.axios
          .get('/sys/v1/common/get/orderStatus/' + typeId, {
            headers: {
              isLoading: false,
            },
          })
          .then((res) => {
            // console.log('订单状态')
            // console.log(res);
            if (res.code == 0) {
              this.status = res.data
            } else {
              this.$message.error(res.message)
            }
          })
      }

      // 部门选择--物流导单
      if (this.parArray.indexOf('bmxz') != -1) {
        this.axios
          .get(
            '/sys/v1/common/by/group?groupId=' + 'sales_authority',
            {
              headers: {
                isLoading: false,
              },
            }
          )
          .then((res) => {
            // ////console.log('部门选择--物流导单')
            // ////console.log(res);
            if (res.code == 0) {
              this.logisticsCont = res.data
            } else {
              this.$message.error(res.message)
            }
          })
      }
    },

    // 多选
    selectAllEvent ({ checked, records }) {
      this.multipleSelection = records
      console.log(this.multipleSelection, "1")
    },
    selectChangeEvent ({ checked, records }) {
      this.multipleSelection = records
      console.log(this.multipleSelection, "2")
    },
    //    导入单号

    orderImport (fileObj) {
      console.log(fileObj)
      let formData = new FormData()
      formData.append('file', fileObj.file)
      this.logFile = formData
    },
    // 导入数据请求
    popInAxios: _.debounce(function (type) {
      let str = ''
      console.log(type)
      if (type) {
        str = '/order/sync/order/import/temporary/storage'
      } else {
        str = '/order/sync/order/import/send/goods'
      }
      let config = {
        headers: {
          'Content-Type': 'multipart/form-data',
        },
        timeout: 60000,
      }
      this.axios
        .post(str, this.logFile, config)
        .then((res) => {
          ////console.log(res);
          if (res.code == 0) {
            this.downloadlink(res.data)
            this.$message.success(res.message)
            // this.$alert(
            //     '成功的数量 ' +
            //         res.data.importSuccessNumber +
            //         '条,  更新的数量' +
            //         res.data.importUpdateSuccessNumber +
            //         '条,  失败的数量' +
            //         res.data.importErrorNumber +
            //         ' 条',
            //     '提示',
            //     {
            //         confirmButtonText: '确定',
            //     }
            // )
            if (res.data.errorUrl) {
              let url = this.ImgHttps + res.data.errorUrl //创建下载链接
              let link = document.createElement('a') //创建a标签
              link.style.display = 'none' //将a标签隐藏
              link.href = url //给a标签添加下载链接
              link.setAttribute('download', '物流单号') // 此处注意，要给a标签添加一个download属性，属性值就是文件名称 否则下载出来的文件是没有属性的，空白白
              document.body.appendChild(link)
              link.click() //执行a标签
            }
          } else {
            this.$message.error(res.message)
          }
        })
        .catch()
    }, 300),

    // 手动出库
    deliveryTrue: _.debounce(function () {
      this.axios
        .post(
          '/order/logistics/send/goods',
          {
            request: {
              logisticsCompany: this.logist.name,
              orderId: this.logId,
              parcelNumber: this.logist.number,
              warKeeper: this.logist.chargeName, //仓库负责人
              godownOrder: this.logist.deliveryNo, // 出库单号
              handlerBy: this.logist.handler, //经手人
              wareOut: this.logist.wareOut, // 出库仓库
            },
            version: '',
          },
          {
            header: {
              isLoading: false,
            },
          }
        )
        .then((res) => {
          if (res.code == 0) {
            this.$message.success('发货成功')
            this.backOrder(1)
          } else {
            this.$message.error(res.message)
          }
        })
    }, 300),

    // 修改代收价格
    fixprice (row) {
      console.log(row)
      this.modify = true
      this.modifyPrice = row
    },
    waitLogiterMoney: _.debounce(function () {
      let price =
        Number(this.modifyPrice.awaitIncomeMoney) -
        Number(this.moneyWait)
      if (price >= 0) {
        this.axios
          .post(
            '/order/order/user/updateawaitmoney',
            {
              awaitIncomeMoney: price,
              orderId: this.modifyPrice.orderId,
            },
            {
              headers: {
                isLoading: false,
              },
            }
          )
          .then((res) => {
            // console.log(res);
            if (res.code == 0) {
              this.$message.success('修改成功')
              this.modify = false
              this.activeName = 5
              this.logisticsEvent(1, 1)
            } else {
              this.$message.error(res.message)
            }
          })
      } else {
        this.$message.warning('代收金额不能大于代付金额')
      }
    }, 300),
    is_null (content) {
      if (content) {
        return false
      } else {
        return true
      }
    },
    // 仓库列表
    wareHouse () {
      this.axios
        .get('/order/comm/commodity/selectCommWarehouse', {
          headers: {
            isLoading: false,
          },
        })
        .then((res) => {
          //   console.log(res);
          if (res.code == 0) {
            this.warelist = res.data
          } else {
            this.$message.error(res.message)
          }
        })
    },
    getAddrData (e) {
      // console.log(e);
      this.queryForm.province = e[0].name
      this.queryForm.city = e[1] ? e[1].name : ''
      this.queryForm.area = e[2] ? e[2].name : ''
    },

    returnGoods (e) {
      this.$router.push({
        path: 'applyReturnGoods',
        query: {
          id: e.orderUser.orderIdStr,
        },
      })
    },
    // 换货
    exchangeGoods (row) {
      this.$router.push({
        name: 'add_order',
        query: {
          orderId: row.orderUser.orderIdStr,
          userId: row.orderUser.userId,
          exchange: 1,
          pingZ: true,
        },
      })
      sessionStorage.removeItem('goodsList')
      sessionStorage.removeItem('giftList')
      sessionStorage.removeItem('voucher')
    },
    // 被退货
    returnedEvent (row) {
      this.$router.push({
        name: 'clientReject',
        query: {
          orderId: row.orderUser.orderIdStr,
          jage: 1,
        },
      })
    },
    // 拒收
    rejectEvent (id) {
      this.$router.push({
        name: 'clientReject',
        query: {
          orderId: id,
          jage: 0,
        },
      })
    },
    updateOdd () {
      this.axios
        .post('/order/logistics/updateParcelNumber', {
          orderId: this.updateOddObj.orderIdStr,
          parcelNumber: this.updateOddObj.parcelNumber,
          logisticsCompany: this.updateOddObj.logisticsCompany,
        })
        .then((res) => {
          this.searchEvent()
          this.updateOddVis = false
        })
    },

    orderImportLive (fileObj) {
      let formData = new FormData()
      formData.append('file', fileObj.file)
      this.logFile1 = formData
    },

    // 导入数据请求
    popInAxiosLive () {
      this.$refs.tops.clearFiles()
      let config = {
        headers: {
          'Content-Type': 'multipart/form-data',
        },
        timeout: 60000,
      }
      this.axios
        .post('/order/order/user/addAONE', this.logFile1, config)
        .then((res) => {
          ////console.log(res);
          if (res.code == 0) {
            this.$alert(
              '导入成功的数量: ' +
              res.data.importSuccessNumber +
              '条,  导入更新的数量: ' +
              res.data.importUpdateSuccessNumber +
              ' 条,  导入失败的数量: ' +
              res.data.importErrorNumber +
              '条',
              '提示',
              {
                confirmButtonText: '确定',
              }
            )
            if (res.data.errorUrl) {
              let url = this.ImgHttps + res.data.errorUrl //创建下载链接
              let link = document.createElement('a') //创建a标签
              link.style.display = 'none' //将a标签隐藏
              link.href = url //给a标签添加下载链接
              link.setAttribute('download', '直播部') // 此处注意，要给a标签添加一个download属性，属性值就是文件名称 否则下载出来的文件是没有属性的，空白白
              document.body.appendChild(link)
              link.click() //执行a标签
            }
            this.backOrder()
          } else {
            this.$message.error(res.message)
          }
        })
        .catch()
    },

    // 直播订单导入
    orderImportZhibo (fileObj) {
      let formData = new FormData()
      formData.append('file', fileObj.file)
      this.logFileLove = formData
    },

    importAxioslove () {
      this.$refs.live.clearFiles()
      let config = {
        headers: {
          'Content-Type': 'multipart/form-data',
        },
        timeout: 60000,
      }
      this.axios
        .post('/order/order/user/addZHIBO', this.logFileLove, config)
        .then((res) => {
          ////console.log(res);
          if (res.code == 0) {
            this.$alert(
              '导入成功的数量: ' +
              res.data.importSuccessNumber +
              '条,  导入更新的数量: ' +
              res.data.importUpdateSuccessNumber +
              ' 条, ' +
              '导入失败的数量: ' +
              res.data.importErrorNumber +
              '条',
              '提示',
              {
                confirmButtonText: '确定',
              }
            )
            if (res.data.errorUrl) {
              let url = this.ImgHttps + res.data.errorUrl //创建下载链接
              let link = document.createElement('a') //创建a标签
              link.style.display = 'none' //将a标签隐藏
              link.href = url //给a标签添加下载链接
              link.setAttribute('download', '直播部') // 此处注意，要给a标签添加一个download属性，属性值就是文件名称 否则下载出来的文件是没有属性的，空白白
              document.body.appendChild(link)
              link.click() //执行a标签
            }
            this.backOrder()
          } else {
            this.$message.error(res.message)
          }
        })
        .catch()
    },
    // 直播订单导入
  },
}
</script>

<style scoped lang="scss">
.fixNumber {
  span {
    display: inline-block;
    margin-right: 10px;
  }
  /deep/.el-input__inner {
    height: 30px;
    line-height: 30px;
  }
  /deep/.el-input__icon {
    line-height: 30px;
  }
}
/deep/.vxe-table--body {
  width: 100% !important;
}

.div1 {
  margin-left: -16px;
  background: url(../../../assets/breadcrumb2.png);
  width: 120px;
  height: 30px;
  text-align: center;
  line-height: 30px;
  color: #2d7edf;
}

.div2 {
  margin-left: -16px;
  background: url(../../../assets/breadcrumb1.png);
  width: 120px;
  height: 30px;
  text-align: center;
  line-height: 30px;
  color: #fff;
}
/deep/.el-textarea {
  width: 537px;
}
.note {
  margin-top: 10px;
  font-size: 14px;

  span {
    font-size: 14px;
    color: red;
  }
}
/deep/.el-badge {
  margin-top: -2px;
  /deep/.el-badge__content {
    top: 7px;
  }
}
/deep/.vxe-table .vxe-cell {
  white-space: inherit;
  width: 100% !important;
}
/deep/.is-leaf {
  color: #2d7ddf;
  text-align: center;
}

/deep/.el-table .cell {
  text-align: center;
}

/deep/.el-cascader--mini {
  width: 350px;
}

/deep/.vxe-header--column {
  color: #2d7ddf;
}

/deep/.table .vxe-body--row {
  background: #ebf0f9;
  color: #000;
}
//  /deep/ .el-button {
//     padding: 10px 13px;
//     margin-top:10px;
//   }

/deep/.el-dialog__header {
  border-bottom: 1px solid #d9d9d9;
}

/deep/.el-form-item__content {
  vertical-align: middle;
  display: inline-block;
}

/deep/.el-dialog {
  position: relative;
  margin: 0 auto 50px;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
}

/deep/.el-dialog__headerbtn {
  top: 15px;
}

/deep/.distpicker-address-wrapper select {
  padding: 0rem 0.75rem;
  height: 30px;
  line-height: 30px;
  font-size: 15px;
}

/deep/ .expanded {
  background: #ebf0f9;
  color: #000;
}

/deep/.el-table__expanded-cell[class*="cell"] {
  padding: 0px 50px;
}

.header {
  display: flex;
  justify-content: space-between;
  padding-bottom: 10px;
  span {
    font-size: 15px;

    color: #333;
  }
  p {
    font-size: 12px;
    color: #2d7edf;
  }
  p:hover {
    cursor: pointer;
  }
}

/deep/.el-tabs__header {
  margin: 0;
}

.inquiry {
  background: #fff;
  padding: 10px;
  margin-top: 10px;
}

.selectDate {
  display: inline-block;
  margin-right: 20px;

  span {
    display: inline-block;
    font-size: 15px;
    margin-right: 15px;
    vertical-align: middle;
  }

  .picker {
    display: inline-block;
    vertical-align: middle;
  }

  /deep/.el-input__inner {
    width: 250px;
    height: 28px;
    line-height: 28px;
  }

  /deep/ .el-date-editor .el-range__icon {
    line-height: 23px;
  }

  /deep/ .el-date-editor .el-range-separator {
    line-height: 23px;
  }

  /deep/.el-date-editor .el-range__close-icon {
    line-height: 22px;
  }
}

.table {
  margin: 10px 0 0px;
  overflow-x: hidden;

  /deep/ .el-input--suffix .el-input__inner {
    background: #409eff;
    color: #fff;
    width: 104px;
    box-shadow: none;
  }

  // /deep/ .el-button {
  //   padding:8px 13px;
  // }
}

/deep/.el-table thead {
  color: #2d7edf;
  text-align: center;

  .cell {
    text-align: center;
  }
}

.operation {
  display: inline-block;
  margin-left: 20px;

  img {
    width: 20px;
    height: 20px;
  }
}

/deep/.el-table td,
.el-table th {
  text-align: center;
}

.page {
  // margin: 20px 0;
  padding-right: 20px;
  text-align: right;
  width: 98%;
  position: fixed;
  bottom: 0;
  right: 0;
  background: #f5f5f5;
  z-index: 100;

  span {
    font-size: 15px;
    color: #666;
    display: inline-block;
    margin-left: 10px;
    vertical-align: middle;
  }

  .el-pagination {
    display: inline-block;
    vertical-align: middle;
  }

  /deep/.el-input--suffix .el-input__inner {
    background: #fff;
    color: #000;
    width: 104px;
    box-shadow: none;
  }
}

.demo-table-expand {
  text-align: left;
}

// .demo-table-expand label {
// 	// width: 200px;
// 	color: #99a9bf;
// }

.demo-table-expand .el-form-item {
  margin-right: 0;
  margin-bottom: 0;
}

/deep/.el-form-item {
  margin-bottom: 6px;
}

/deep/.el-table__row:hover {
  color: rgb(45, 125, 223);
}

.btn {
  span {
    display: inline-block;
    color: rgb(45, 125, 223);
    margin-right: 10px;
  }
}

.btn:hover {
  cursor: pointer;
}

.logHeader {
  .images {
    display: inline-block;
    vertical-align: middle;
    // width: 120px;
    height: 60px;
  }

  span {
    display: inline-block;
    vertical-align: middle;
    margin-left: 20px;
  }
}

.trackingNode {
  height: 300px;
  overflow-y: scroll;
  display: flex;
}

.aloneDelivery {
  p {
    margin-bottom: 10px;
  }

  span {
    display: inline-block;
    vertical-align: middle;
  }

  /deep/.el-input {
    display: inline-block;
    width: 400px;
    vertical-align: middle;
    margin-left: 10px;
  }

  /deep/.el-input__inner {
    height: 30px;
    line-height: 30px;
  }
}

.aloneDeliveryHouse {
  p {
    margin-bottom: 20px;
    margin-right: 20px;
  }

  span {
    display: inline-block;
    vertical-align: middle;
    width: 78px;
  }

  /deep/.el-input {
    display: inline-block;
    width: 200px;
    vertical-align: middle;
    margin-left: 10px;
  }

  /deep/.el-input__inner {
    height: 30px;
    width: 200px;
    line-height: 30px;
  }

  /deep/.el-input__icon {
    height: 30px;
    line-height: 30px;
  }
}
.navBtns {
  /deep/.el-button {
    margin-top: 5px;
  }
}
.boxBtns {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
}
.orderStyle {
}
.orderStyle_one {
  font-size: 14px;
  color: #aaa;
  margin-bottom: 10px;
}
.orderStyle_text {
  padding-left: 10px;
  font-size: 14px;
  color: #bbb;
  margin-bottom: 10px;
}
</style>
